package org.huawei260.TiKu;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class D2 {


//	public class Main {
		public static void main(String[] args) {
			Scanner scanner = new Scanner(System.in);
			List<String> lines = new ArrayList<>();

			while (true) {
				String line = scanner.nextLine();
				if (line.isEmpty()) {
					System.out.println(processLines(lines));
					break;
				} else {
					lines.add(line);
				}
			}
		}

		private static String cleanString(String input) {
			input = input.replaceAll("\\[\"']", "");
			input = input.replaceAll("\".*?\"", "a");
			input = input.replaceAll("'.*?'", "a");
			input = input.replaceAll("-.+", "");
			input = input.replaceAll("\\s+", "");
			input = input.replaceAll(";+", ";");
			return input;
		}

		private static int processLines(List<String> lines) {
			StringBuilder processedString = new StringBuilder();
			for (String line : lines) {
				processedString.append(cleanString(line));
			}

			processedString.append(";");

			String finalString = processedString.toString().replaceAll(";+", ";").replaceAll("^;", "");

			int count = 0;
			for (char character : finalString.toCharArray()) {
				if (character == ';') {
					count++;
				}
			}

			return count;
		}
	}
